//
// Created by shaowenhan on 2020/4/22.
//

#include "Double.h"

bool isEqual(double a, double b, double precision) {
    return fabs(a-b) <= precision;
}

bool isZero(double a, double precision) {
    return isEqual(a, 0.0, precision);
}

bool isFirstLessThanSecond(double a, double b, double precision) {
    return a < b-precision;
}

bool isFirstLessThanOrEqualToSecond(double a, double b, double precision) {
    return isFirstLessThanSecond(a, b, precision) or isEqual(a, b, precision);
}

bool isFirstGreaterThanSecond(double a, double b, double precision) {
    return a > b+precision;
}

bool isFirstGreaterThanOrEqualToSecond(double a, double b, double precision) {
    return isFirstGreaterThanSecond(a, b, precision) or isEqual(a, b, precision);
}
